<form id="add-form" class="form-horizontal" style="position:relative;background: #fff" role="form" data-toggle="validator" method="POST" action="">
    
    <div class="panel-body">
        <div id="myTabContent" class="tab-content" >
            <div class="tab-pane fade active in" id="tabs_0">
                <input type="hidden" name="row[id]" value="" class="form-control" data-rule="" data-tip="id"  />

                   <div class="form-group">
                        <label for="c-column_pid" class="control-label col-xs-12 col-sm-2">父栏目:</label>
                        <div class="col-xs-12 col-sm-8" id="div-pid">
                        <div style="margin-top:-2px">
                            <input id="c-column_pid" data-rule="" data-select-only="true"
                                   data-source="/adminht.php/column/column/lists" data-multiple="false" data-field="name" data-value=""
                                   class="form-control selectpage" data-rule="require" name="row[pid]"
                                   type="text" value="">
                        </div>
                        </div>
                   </div>

                   <div class="form-group">
                        <label for="c-column" class="control-label col-xs-12 col-sm-2">名称:</label>
                        <div class="col-xs-12 col-sm-8" id="div-column">
                            <input type="text" id="c-column" name="row[column]" value="" class="form-control" title="column"  placeholder="" data-rule=""  data-tip="名称"  />
                        </div>
                   </div>

                    <div class="form-group">
                        <label for="c-diff" class="control-label col-xs-12 col-sm-2">类型:</label>
                        <div class="col-xs-12 col-sm-8" id="c-diff">
                            <label for="row[diff]-0"><input id="row[diff]-0" name="row[diff]" type="radio" value="0" data-tip="学校首页头部栏目" checked/> 首页栏目</label>
                            <label for="row[diff]-1"><input id="row[diff]-1" name="row[diff]" type="radio" value="1" data-tip="空中课堂侧边栏目" /> 课堂类别</label>
                        </div>
                    </div>

                <div class="form-group">
                    <label for="c-type" class="control-label col-xs-12 col-sm-2">是否固定:</label>
                    <div class="col-xs-12 col-sm-8" id="c-type">
                        <!-- 先显示单选框，然后用JavaScript根据权限控制 -->
                        <label for="row[type]-0"><input id="row[type]-0" name="row[type]" type="radio" value="0" data-tip="不固定" checked /> 不固定</label>
                        <label for="row[type]-1"><input id="row[type]-1" name="row[type]" type="radio" value="1" data-tip="固定" /> 固定</label>
                        <div class="help-block">
                            <small class="text-muted">注意：只有超级管理员和城市管理员才能设置固定栏目</small>
                        </div>
                        
                        <!-- 权限控制脚本 -->
                        <script>
                        $(document).ready(function() {
                            // 延迟执行，确保Config对象已加载
                            setTimeout(function() {
                                var canEditType = false;
                                
                                // 检查权限
                                if (typeof Config !== 'undefined') {
                                    if (Config.canEditType === true) {
                                        canEditType = true;
                                    } else if (Config.admin && Config.admin.group && Config.admin.group.id) {
                                        var groupId = parseInt(Config.admin.group.id);
                                        if (groupId === 1 || groupId === 2) {
                                            canEditType = true;
                                        }
                                    }
                                }
                                
                                console.log('Add页面权限检查:', canEditType, Config);
                                
                                // 如果没有权限，禁用字段
                                if (!canEditType) {
                                    $('#c-type').html('<span class="form-control-static text-muted">不固定（仅超级管理员和城市管理员可设置）</span><input type="hidden" name="row[type]" value="0" />');
                                }
                            }, 500);
                        });
                        </script>
                    </div>
                </div>

                <div class="form-group layer-footer">
                    <label class="control-label col-xs-12 col-sm-2"></label>
                    <div class="col-xs-12 col-sm-8">
                        <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
                        <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                    </div>
                </div>
            </div>
            
        </div>
    </div>
</form>



